<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="__STATIC__/js/jquery.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script type="text/javascript" src="__STATIC__/x-admin/js/xadmin.js"></script>
    <link rel="stylesheet" href="__STATIC__/x-admin/css/font.css">
    <link rel="stylesheet" href="__STATIC__/x-admin/css/xadmin.css">
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css">
    <script src="__JS__/socket/socket.js"></script>
</head>
<body>
<div style="height: 20px"></div>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="{:url('/equipment/index')}">设备管理</a>
        <a href="#">设备状态</a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<span style="text-align: center;display:block;font-size: 20px;color: red" id="number">{$number}</span>
<br/>
<br/>
<span style="text-align: center;display:block;">
    <button class="layui-btn layui-btn-danger" id="shutdown">关机</button>
    <button class="layui-btn layui-btn-warm" id="restart">重启</button>
    <button class="layui-btn layui-btn-primary" id="lowerNumber">下发编号</button>
    <button class="layui-btn layui-btn-primary" id="mialList">通讯录</button>
    <button class="layui-btn layui-btn-normal" id="closeMonitor">关闭监测模式</button>
    <button class="layui-btn layui-btn-danger" id="care">开启关爱模式</button>
    <button class="layui-btn layui-btn-warm" id="closeCare">关闭关爱模式</button>
</span>
</body>
<script>
    //关机指令
    $("#shutdown").click(function(){
        var number = $("#number").html();
        var info = {
            number:number,
            type:'shutdown'
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/restartOrShutdown')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    });
    //重启指令
    $("#restart").click(function () {
        var number = $("#number").html();
        var info = {
            number:number,
            type:'restart'
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/restartOrShutdown')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    })
    //通讯录
    $("#mialList").click(function(){
        var number = $("#number").html();
        var info = {
            number:number,
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/mailList')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    });
    //开启检测模式
    $("#openMonitor").click(function(){
       // console.log(1)
        var number = $("#number").html();
        var info = {
            number:number,
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/open')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    });
    //关闭检测模式
    $("#closeMonitor").click(function(){
        var info = {
            number:$("#number").html(),
            instructions:'monitoring',
            status:'close'
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/close')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    });
    //下发编号
    $("#lowerNumber").click(function () {
        var info = {
            number:$("#number").html()
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/number')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    })
    //开启关爱模式
    $("#care").click(function () {
        var info = {
            number:$("#number").html(),
            type:'care'
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/careOrCloseCare')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    })
    //关闭关爱模式
    $("#closeCare").click(function () {
        var info = {
            number:$("#number").html(),
            type:'closeCare'
        };
        $.ajax({
            url:"{:url('/watch_instructions_record/careOrCloseCare')}",
            type:"post",
            data:info,
            dataType:"json",
            success:function(res){
                if(res.code){
                    layer.msg(res.msg,{icon:1,time:2000});
                }else{
                    layer.msg(res.msg,{icon:5,time:2000});
                }
            }
        });
    })
</script>
</html>